package nowcoder.day_48.day14;

import java.util.Arrays;
import java.util.Scanner;

public class Num2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[]data = new int[n];
        for (int i = 0; i < n; i++) {
            data[i] = in.nextInt();
        }
        Arrays.sort(data);
        System.out.println(Count(data , n , 0 , 0 , 1));
    }

    public static int Count(int[]data , int n , int start , int sum , int multi) {
        int count = 0;
        for (int i = start; i < n; i++) {
            sum += data[i];
            multi *= data[i];
            if (sum > multi){
                count = count + 1 + Count(data , n , i+1 ,sum ,multi);
            }else if (data[i] == 1){
                count = count + Count(data , n , i+1 ,sum ,multi);
            }else {
                break;
            }
            sum -= data[i];
            multi /= data[i];
            while (i < n - 1 && data[i] == data[i + 1]){
                i++;
            }
        }
        return count;
    }
}
